package com.lagou.edu.listener;

import com.lagou.edu.factory.BeanFactory;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * 监听容器初始化，加载所以bean
 */
public class MyListener implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        System.out.println("容器初始化开始");
        BeanFactory.getInstance();
        System.out.println("容器初始化结束");
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        System.out.println("容器销毁");
    }
}
